import axios from 'axios'
import React,{useState,useEffect} from 'react'
import { useSearchParams } from 'react-router-dom'
function Index() {
  const [list,setList] = useState([])
  const [sp]=useSearchParams()
  const start=sp .get('start')
  const end=sp .get('end')
  const getlist=async()=>{
    const res=await axios.get('/api/trip/airplane',{params:{start,end}})
    console.log(res.data.data);
    setList(res.data.data)
    
  }
  useEffect(()=>{
    getlist()
  },[])
  return (
    <div>
      {
        list.length>0&&list.map((item,ind)=>{
          return <div key={ind}>
            <p>{item.dasn}</p>
            <p>{item.dst}</p>
            <p>{item.at}</p>
            <p>{item.aasn}</p>
            <p>{item.aat}</p>
            <p>{item.ast}</p>
            <p>{item.at}</p>
          </div>
        })
      }
    </div>
  )
}

export default Index